<template>
    <drag-modal  :visible="callVisible" @cancel="onCallClose" width="300px" :footer="null" :titleClass="titleClass" :mask="false">
       	<div  class="information-frame">
				<div class="information-second">
					<div class="second-txt phone-txt-color">信号：{{SIMlevel}} {{SIMServer}}</div>
					<div class="second-txt phone-txt-color">SIM：
                        <span class="mr-2 b" :style="SIMcurrent == 0 ? 'color:green':''" style="font-weight: bold;" v-show="SIMState.s1">1</span>
                        <span class="mr-2 b" :style="SIMcurrent == 1 ? 'color:green':''" style="font-weight: bold;" v-show="SIMState.s2">2</span>
                        <span class="mr-2 b" :style="SIMcurrent == 2 ? 'color:green':''" style="font-weight: bold;" v-show="SIMState.s3">3</span>
                        <span class="mr-2 b" :style="SIMcurrent == 3 ? 'color:green':''" style="font-weight: bold;" v-show="SIMState.s4">4</span>
                        <span class="mr-2 b" :style="SIMcurrent == 4 ? 'color:green':''" style="font-weight: bold;" v-show="SIMState.s5">5</span>
                    </div>
				</div>
				<div class="information-third">
					<div class="third-box" @click="SwitchNext">
                        <a-icon type="file-sync" class="btns-icon phone bt-color"/>
						<div class="phone-name ">
							换卡
						</div>
					</div>
					<div class="third-box" @click="reconnect">
                        <a-icon type="file-sync" class="btns-icon phone bt-color"/>
						<div class="phone-name " >
							重连
						</div>
					</div>
					
				</div>
                <div class="information-first" v-show="devicename">
                    <a-icon class="btns-icon phone phone-name" type="phone" />
					<div class="phone-name">
						{{talkState}}
					</div>
				</div>
                <div class="information-first" v-show="!devicename">
                    <a-icon class="btns-icon phone-lose" type="phone" theme="filled"/>
				</div>
			</div>
         <!-- 拨号盘 -->
        <div v-show="!callOpen && readyCallOpen" class="phone-frame">
			<div class="nomber-style">
				<input class="nimber-inpt" v-model="temporaryNumber" placeholder="请输入电话号码">
			</div>
			<!-- 键盘 -->
			<div class="keyboard">
                <div v-for="(item,i) in keyboard" @click="choice_number(item)" class="keyboard-number">{{item}}</div> 
			</div>
			<div class="input-list">
				<div style="height: 35px;">
                    <a-checkbox v-model="temporaryIsAutoAudio" style="color:#fff;">
                        去放电音
                    </a-checkbox>
                    <i v-show="!temporaryAudioLocalPath" class="fas fa-music" style="font-size:16px;color:red;" title="临时音频未准备"></i>
                    <i v-show="temporaryAudioLocalPath" class="fas fa-music" style="font-size:16px;color:green;" title="临时音频准备就绪"></i>
					<!-- <input type="checkbox" style="position: relative; top: 3px; " > 去电放音 -->
				</div>
				<div class="input-list-nin" >
					<div >
						选择文件：
                        <a-select class="inp-style" placeholder="请选择选择音频" :value="temporaryVoiceId" @change="onVoiceChange" size="small" :dropdownMenuStyle="{fontSize:'0.8rem;'}">
                            <a-select-option :label="item.title" v-for="(item, index) in voiceSelectData" :key="item.key + index" :value="item.key" :title="item.title">
                                {{item.title}}
                            </a-select-option>
                        </a-select>
                        <!-- <input class="inp-style"/> -->
					</div>
					<div>
                        <a-upload
                            accept="audio/wav"
                            name="file"
                            :multiple="true"
                            :action="voiceUploadUrl"
                            :headers="uploadHeaders"
                            :show-upload-list="false"
                            :before-upload="beforeUpload"
                            @change="voiceUploadChange"
                            >
                            <span class="button-style" title="音频只支持WAV格式,特别需要注意的是播放的语音文件建议采样率最大不要超过48000HZ，16位。
                            因为设备自带声卡目前最大支持16位，48000HZ音质。
                            语音文件要使用单声道，因为只有右声道声音可以被远端手机听到。">
                                <a-icon type="plus-circle"  style="font-size:20px;color:green;"/>
                            </span>
                        </a-upload>

						<!-- <span class="button-style">></span>
						<span class="button-style">+</span> -->
					</div>
				</div>
				
			</div>
			<div @click="onTemporaryDial" class="phone-type" >
				拨打
			</div>
		</div>
         <!-- 状态盘 -->
		<div v-show="callOpen" class="phone-frame">
			<div class="nomber-style-title">
				{{talkState}}
			</div>
			<div class="nomber-style">
				{{phoneNumber}}
			</div>
            <!-- 音频播放提示 -->
            <div v-show="playAudioWarning">
                <!-- <a-slider  :value="playAudioWarningData.currentTime" :min="0" :max="playAudioWarningData.duration" :tooltip-visible="true" />
                <div>总时长：{{playAudioWarningData.duration}}</div> -->
                <myAudio ref="myAudioOne"  @callBack="OnTalkStopAudio"></myAudio>
                <!-- <audio  ref="playAudioWarningDome" @canplay="getDuration" @timeupdate="updateTime" src="" controls="controls" hidden  style="margin: 5px; width: -moz-available; height: 30px;"></audio> -->
            </div>
             <!-- 消息提示 -->
            <!-- <div class="messageBox" >
                 <li v-for="(item, index) in callingMessageList" :key="index">
                    {{item}}
                </li>
            </div> -->
			<div class="phone-bottom-list tow-bottom">
                <div @click="OnAnswer" type="primary" v-show="talkState=='呼入中...'" class="phone-type">
					接听
				</div>
				<div @click="OnHangup" class="phone-type" style="color:red;">
					挂断
				</div>
				<div @click="OnTalkStopAudio" class="phone-type" v-show="isShowIntervention">
					介入
				</div>
			</div>
		</div>
    </drag-modal>
</template>

<script>
import moment from "moment";
import { mapState } from "vuex";
import { ACCESS_TOKEN } from "@/store/mutation-types";
import myAudio from '@/components/Crm/myaudio';

let timer; 
export default {
    components: {
        myAudio,
    },
    props: {
        itemData: {
            type: Object,
            default: {}
        }
    },
    data () {
        //外呼基础设置
        const baseSettingsList = [
            {
                className:"音量设置",       //分类
                code:"localaudio",
                value:"50",
                dataType: 1,        //数据类型 1：数字 2：字符串 3.Boolean
                showName:"本地听到音量"
            },
            {
                className:"音量设置",       //分类
                code:"phoneaudio",
                value:"50",
                dataType: 1,        //数据类型 1：数字 2：字符串 3.Boolean
                showName:"对方听到音量"
            },
            {
                className:"换卡设置",       //分类
                code:"isAutoChangeSIM",
                value:"true",
                dataType: 3,        //数据类型 1：数字 2：字符串 3.Boolean
                showName:"是否自动换卡"
            },
            {
                className:"换卡设置",       //分类
                code:"maxCallTimes",
                value:"5",
                dataType: 1,        //数据类型 1：数字 2：字符串 3.Boolean
                showName:"换卡频率"
            },
        ];
        return {
            titleClass: "ttc",
            callWebSocket: null,
            callVisible: false,             //整体 弹窗显示
            baseSettingsList,
            voice_pay: false,       // 语音播放
            keyboard: [1,2,3,4,5,6,7,8,9,'*',0,'#'],
            //语音盒子
            timeout: 50000,             //websocek 心跳间隔
            talkPlayAudioUrl:"http://192.168.1.172:8089/audio/112/20220311/亿维自动电话营销机广告语.mp3",        //云端音频地址 测试
            talkPlayAudio:"",           //通话中 播放音频地址(本地地址 默认是相对地址，修改WEB下载地址)
            // devicename: null,           //设备名称     
            readyCallOpen: false,       //打开拨号盘          
            callOpen: false,            //打开状态盘
            talkid:null,            //当前通话id
            talkState: '空闲...',//当前拨号状态
            callingType: 1,             // 拨打模式 1.人工 2.自动播放语音人工随时介入
            isAutoChangeSIM: true,      //是否开启 自动换卡功能
            maxCallTimes: 5,           // 最大拨打次数，进行顺序换卡
            phoneaudio: 50,             //手机听到音量
            localaudio: 50,             //本地听到音量
            isSetAudio:false,           //初次 是否设置语音
            callingLinkMan: {},           //正在拨打电话 的客户
            CBCurrState: [],                //SIM插卡信息    
            loading: false,                 //
            SIMlevel: null,                 //SIM信号
            SIMServer: null,                //运营商
            SIMState:{
                s1:0,
                s2:0,
                s3:0,
                s4:0,
                s5:0,
                s6:0
            },                              //插卡状态
            SIMcurrent:null,                //当前卡槽
            SIMcurrentCallTimes:0,          //当前卡槽 拨打次数
            isChannelToHeadSet:true,        //是否听到对方声音
            isHeadSetToChannel:true,        //是否让对方听到声音
            testTalkPlayAudio:'webaudiodownload\\TestAudio.wav',            //测试 音频播放地址
            leaveTime: 0,                   //休息时间
            callingSleppTimer:null,         //
            isIntervene:false,              //是否干预（介入）
            /*** 临时拨号 ****/
            temporaryIsAutoAudio: false,    //（临时）是否开启 播放语音
            temporaryVoiceId:null,             //（临时）音频ID
            temporaryVoiceUrl:'',           //（临时）音频地址
            temporaryAudioLocalPath:'',     //（临时）通话中 播放音频地址(本地地址 默认是相对地址，修改WEB下载地址)
            temporaryNumber:"",              //（临时）电话号码
            //------------音频----------------
            voiceUploadUrl:this.$Global.ApiBaseUrl + '/crm/callVoice/uploadVoice',
            voiceSelect:"",         //选择的值
            uploadHeaders:{},       //音频上传 请求头部
            downLoadType:1,         //下载 云端语音 到 语音盒子 类型 1.任务 2.临时拨号
            // settings: null,         //外呼配置
            phoneNumber:"",         //号码显示
            callParams: null,       //拨打参数
            openBoxData: null,      //打开弹窗 额外传参
            localAudioMap: new Map(),       //下载语音盒子的音频 Map key:远程语音地址 value:本都语音地址
            isShowIntervention: false,      //是否显示介入按钮
            callingMessageList: [],             //拨打消息
            dateFormat: "YYYY-MM-DD HH:mm:ss", //任务时间格式
            playAudioWarning: false,         //是否显示 去电放音精度
            playAudioWarningData: {
                currentTime:0,
                duration:20
            },
        };
    },
    //接口调用（数据准备）
    created(){
        // this.$store.dispatch("ListCallSettings");   //获取外呼设置
        // this.$store.dispatch("ListVoicePage");      //获取音频列表
        this.createWebSocket();
        const token = Vue.ls.get(ACCESS_TOKEN);
        if (token) {
            this.uploadHeaders[ACCESS_TOKEN] = token; 
        }
    },
    computed: {
        ...mapState({
            userInfo: state => state.user.info,
            permissions: state => state.user.permissions,
            voiceSelectData: state => state.callingBox.voiceSelectData,         //音频列表
            voiceMap: state => state.callingBox.voiceMap,                       //音频Map存储
            settings: state => state.callingBox.settings,                       //外呼设置 
            devicename: state => state.callingBox.devicename,                   //设备名称
        }),
    },
    methods: {
        moment,
        onCallClose(){
            console.log("关闭外呼盒子时，拨打状态talkState：",this.talkState);
            if(this.talkState == '呼出中...' || this.talkState == '振铃中...' || this.talkState == '呼出接通' ){
                this.$message.warning(this.talkState + "，不能关闭")
                return;
            }
            this.resetCallBox();
            this.OnHangup();
        },
        resetCallBox(){
            this.callVisible = false;
            this.callOpen = false;
            this.readyCallOpen = false;
            this.temporaryNumber = '';
            this.phoneNumber = '';
            this.callParams = null;
            this.playAudioWarning = false;
            this.StopPlayAudioWarning();
        },
        //打开拨号盘 
        openCallingBox(callParams,data){
            let { devicename,callingMessageList,dateFormat ,callWebSocket,localAudioMap} = this;
            if(!callWebSocket){
                this.$message.warning('重新连接中...,请稍后再试');
                this.createWebSocket();
                return;
            }
            if(!devicename){
                this.$message.warning('请插入设备');
                return;
            }
            let now = moment().format(dateFormat);
            let openBoxType = '人工拨打';
            this.$store.dispatch("ListVoicePage");      //获取音频列表
            console.log("外呼弹窗openCallingBox：",callParams,data);
            this.callParams = null;
            this.openBoxData = data;
            this.callVisible = true;
            
           
            this.isShowIntervention = false;
            this.talkPlayAudio = null;
            this.temporaryIsAutoAudio = false;
            this.temporaryVoiceId = null,
            this.temporaryVoiceUrl = '';
            this.temporaryAudioLocalPath = null;
            if(data){
                const {callType,voiceUrl,voiceId,isPlayAudio} = data;
                if(callType == 2 && voiceUrl){
                    this.temporaryIsAutoAudio = true;
                    this.temporaryVoiceId = voiceId;
                    let talkPlayAudio = localAudioMap.get(voiceUrl);
                    if(talkPlayAudio) {
                        this.talkPlayAudio = talkPlayAudio;
                        this.temporaryAudioLocalPath = talkPlayAudio;
                    }else{
                        this.AudioDownload(voiceUrl,0);
                    }
                }
                if(isPlayAudio){
                    openBoxType ='去电放音';
                }
            }
            if(!callParams){
                this.readyCallOpen = true;
                // 添加拨打消息
                let callingMessage = now + " -----打开拨号盒子-----:" + openBoxType;
                callingMessageList.push(callingMessage);
                // this.$message.warning("拨打参数错误，请联系管理员");
                return;
            }
            this.callParams = callParams;
               // 添加拨打消息
            let callingMessage = now + " -----打开拨号盒子-----:" + openBoxType;
            callingMessageList.push(callingMessage);
            this.OnDial (callParams); 
        },

        choice_number(val){
            this.temporaryNumber += val;
            console.log('-----',val)
        },
        //上传之前
        beforeUpload(file) {
            const isOK = file.type.indexOf("audio") > -1;
                // file.type === "audio/wav";
            if (!isOK) {
                this.$message.error("只能选择wav的音频!");
            }
            const isLimitSize = file.size / 1024 / 1024 < 5;
            if (!isLimitSize) {
                this.$message.error("音频不能超过5MB!");
            }
            return isOK && isLimitSize;
        },
        //上传音频
        voiceUploadChange(info){
            let status = info.file.status;
            switch(status){
                case "done":{
                    let { response } = info.file;
                    if(response.code == 200){
                        this.$message.success(info.file.name +",上传成功!");
                        this.$store.dispatch("ListVoicePage");      //获取音频列表
                        // this.voicePage();
                    }else{
                        this.$message.error(info.file.name +",上传失败!");
                    }
                };break;
                case "error":{
                    this.$message.error(info.file.name +",上传失败!");
                };break;

            }
            console.log("上传音频-->结果：",info);
        },
       
        //选择 音频 事件
        onVoiceChange(key){
            this.temporaryAudioLocalPath = '';
            console.log("选择 音频 事件",key)
            let voiceItem = this.voiceMap.get(key);
            if(voiceItem){
                let {id,voiceName,voiceUrl} = voiceItem;
                this.temporaryVoiceId = id;
                this.temporaryVoiceUrl = voiceUrl;
                //下载 web
                if(voiceUrl){
                    this.AudioDownload(voiceUrl,2);
                }
            }
        },
        //重播语音
        audioRepeat(){
            let voiceAudioDom = this.$refs.voiceAudio;
            if(voiceAudioDom){
                voiceAudioDom.currentTime = 0;//重新播放
            }
        },
        //播放/暂停
        audioControl(){
            let voiceAudioDom = this.$refs.voiceAudio;
            console.log("播放音频",voiceAudioDom);
            if(voiceAudioDom && voiceAudioDom.src){
               if(voiceAudioDom.paused){
                    this.voice_pay = true;
                    voiceAudioDom.play();// 播放
                }else{
                    this.voice_pay = false;
                    voiceAudioDom.pause();// 暂停
                }
            }
        },
        onChangeTab(activeTabKey){
            console.log("activeTabKey",activeTabKey);
        },
        /************ 查询 外呼设置 ************/
      
        //开启 休息倒计时
        OnCallingSlepp(){
            let _this = this;
            // this.leaveTime = this.taskItem.intervalTime || 0;
            // this.callingSleppTimer = setInterval(()=>{
            //     _this.leaveTime--;
            //     if(!_this.leaveTime){
            //         clearInterval(_this.callingSleppTimer);
            //     }
            // },1000);
        },
        /**************************  语音盒子 **************************/
        createWebSocket () {
            let { callWay } = this.settings;
            if(callWay != "box")return;
            console.log("监听电话语音盒消息：------------------创建websocket-------------------------------:  ");
            this.callWebSocket = new WebSocket('ws://127.0.0.1:8555/api');
            this.initWebSocket()
        },
        initWebSocket () {
            // 连接错误
            this.callWebSocket.onerror = this.setErrorMessage

            // 连接成功
            this.callWebSocket.onopen = this.setOnopenMessage

            // 收到消息的回调
            this.callWebSocket.onmessage = this.setOnmessageMessage

            // 连接关闭的回调
            this.callWebSocket.onclose = this.setOncloseMessage

            // 监听窗口关闭事件，当窗口关闭时，主动去关闭websocket连接，防止连接还没断开就关闭窗口，server端会抛异常。
            window.onbeforeunload = this.onbeforeunload
        },
        setErrorMessage () {
            console.log('监听电话语音盒消息：WebSocket连接发生错误   状态码：' + this.callWebSocket.readyState);
            // this.$store.dispatch("actionsGetNumber");
            // this.reconnect();
        },
        setOnopenMessage () {
            console.log('监听电话语音盒消息：WebSocket连接成功    状态码：' + this.callWebSocket.readyState)
            this.callWebSocket.send('{"command":"OpenDevice_Multi"}');
            setTimeout(this.OnGetConnectedState(), 3000);
            timer && clearTimeout(timer);
            //心跳检测重置
            this.heartCheck();
        },
        // 根据服务器推送的消息做自己的业务处理
        //ws消息回调
        setOnmessageMessage (event) {
            let msgJsonData = JSON.parse(event.data);
            console.log(new Date(),event.data);
            let type = msgJsonData.type;//type
            switch(type){
                case "CallRecord":this.OnCallRecord(msgJsonData);break;//设备状态上报
                case "CommandResponse":this.OnCommandResponse(msgJsonData);break;//请求返回
                case "DeviceConnectedState":this.OnGetConnectedState();break;//设备连接状态上报
                case "RealTimeState":this.OnRealTimeState(msgJsonData);break;//设备状态上报
                case "CBCallback":this.OnCBCallback(msgJsonData);break;//卡槽拔插上报
            }
        },
        setOncloseMessage () {
            console.log('监听电话语音盒消息： WebSocket连接关闭    状态码：' + this.callWebSocket.readyState)
            // this.reconnect();
        },
        onbeforeunload () {
            this.closeWebSocket()
        },
        closeWebSocket () {
            this.callWebSocket.close()
        },
        reconnect () {
            // //重连webSocket
            // if (this.lockReconnect) {
            //     return;
            // };

            // this.lockReconnect = true;
            // //没连接上会一直重连，设置延迟避免请求过多
            // this.tt && clearTimeout(this.tt);
            // let _this = this;
            // this.tt = setTimeout(function () {
            //     _this.createWebSocket();
            //     _this.lockReconnect = false;
            // }, 4000);
            console.log("重连设备",this.callWebSocket);
            if(this.callWebSocket.readyState ===  1){
                    this.DeviceReConnect();
            }else{
                    this.createWebSocket();
            }
        },
        //连接成功
        OnGetConnectedState () {
            this.SetGetConfig();                            //修改设备配置
            this.GetCommandAction("GetConnectedState_Multi"); //获取设备连接列表
            this.GetCommandAction("GetCBCurrSim_Multi");    //获取当前SIM卡索引
            this.GetCommandAction("GetCBCurrState_Multi");  //插卡状态
            this.GetCommandAction("GetSignalLevel_Multi");  //获取信号
            this.GetCommandAction("GetCCID_Multi");         //获取信号
            // this.GetCommandAction("GetDeviceAudio_Multi");  //获取音量
           
            // this.SetDeviceWindowsAudio();                   //设置设备USB声卡音量
            // if(this.callParams){
            //     this.OnDial(this.callParams);
            // }
        },
        //心跳检测
        heartCheck () {
            let _this = this;
            timer && clearTimeout(timer);
            timer = setInterval(function () {
                console.log('这里发送一个心跳，后端收到后，返回一个心跳消息');
                _this.GetCommandAction("GetSignalLevel_Multi");//获取信号
                _this.GetCommandAction("GetCCID_Multi");//获取信号
            }, this.timeout);
            
        },
        //重连设备
        DeviceReConnect () {
            this.callWebSocket.send('{"command":"CloseDevice_Multi","arguments":{"devicename":"' + this.devicename + '"}}');
            this.callWebSocket.send('{"command":"OpenDevice_Multi"}');
        },
        //获取音频文件下载保存路径
        GetAudioDownloadPath(){
            this.GetCommandAction("GetAudioDownloadPath");
        },
        //重新下载 云端语音 到 语音盒子默认存储路径
        AudioDownloadAgain(voiceUrl){
            if(voiceUrl){
                this.AudioDownload(voiceUrl,1);
            }
        },
        //下载 云端语音 到 语音盒子默认存储路径
        AudioDownload(audioUrl,downLoadType){
            this.downLoadType = downLoadType;
            let { callWebSocket } = this;
            if(!audioUrl){
                this.$message.error("下载语音失败,语音地址不能为空");
                return;
            }
            let command = {
                command:"audiodownload",
                arguments:{
                    url:audioUrl
                },
                content:downLoadType

            }
            console.log("web 下载音频",JSON.stringify(command));
            callWebSocket.send(JSON.stringify(command));
        },
        //远端手机到本地耳机开关
        ChannelToHeadSet(isOpen){
            let { callWebSocket,devicename } = this;
            let command = 'closechanneltoheadset_Multi';
            if(isOpen){
                command = 'openchanneltoheadset_Multi';
            }
            let commandObj = {
                command,
                arguments:{
                    devicename
                }
            }
            console.log("远端手机到本地耳机开关",isOpen,JSON.stringify(commandObj));
            callWebSocket.send(JSON.stringify(commandObj));
        },
        //本地耳机到远端手机开关
        HeadSetToChannel(isOpen){
            let { callingMessageList,dateFormat } = this;
            let now = moment().format(dateFormat);
            this.isIntervene = !isOpen;
            let { callWebSocket,devicename } = this;
            let command = 'closeheadsettochannel_Multi';
            let  openOrClose = "关闭";
            if(isOpen){
                command = 'openheadsettochannel_Multi';
                openOrClose = "开启";
            }   
            let commandObj = {
                command,
                arguments:{
                    devicename
                }
            }
             console.log("本地耳机到远端手机开关",isOpen,JSON.stringify(commandObj));
             // 添加拨打消息
            let callingMessage = now + " 本地耳机到远端手机开关:" + openOrClose;
            callingMessageList.push(callingMessage);
            callWebSocket.send(JSON.stringify(commandObj));
        },
        //通话中 开始播放音频（必须是 语音盒子 本地默认的相对路径）
        OnTalkPlayAudio(extraparam){
            const { callingMessageList,dateFormat } = this;
            let now = moment().format(dateFormat);
            if(extraparam.id){
                let { callWebSocket,devicename,talkPlayAudio,openBoxData} = this;
                let {callType} = extraparam;
                console.log("播放音频",devicename,talkPlayAudio,callType);
                if(callType == 1 || !talkPlayAudio || !openBoxData || !openBoxData.isPlayAudio)return;
                // this.SetPlayAudioWarning();
                let command = {
                    command:"PlayStartRecord_Multi",
                    arguments:{
                        devicename,
                        content:talkPlayAudio
                    },
                }
                console.log("播放音频_command",JSON.stringify(command));
                callWebSocket.send(JSON.stringify(command));
                // 添加拨打消息
                let callingMessage = now + " 播放任务音频：" + talkPlayAudio;
                callingMessageList.push(callingMessage);
            }else{
                let { callWebSocket,devicename,temporaryIsAutoAudio,temporaryAudioLocalPath} = this;
                console.log("临时拨号：播放音频",devicename,temporaryIsAutoAudio,temporaryAudioLocalPath);
                if(!temporaryIsAutoAudio || !temporaryAudioLocalPath)return;
                // this.HeadSetToChannel(false);
                let command = {
                    command:"PlayStartRecord_Multi",
                    arguments:{
                        devicename,
                        content:temporaryAudioLocalPath
                    },
                }
                console.log("临时拨号：播放音频_command",JSON.stringify(command));
                callWebSocket.send(JSON.stringify(command));
                // 添加拨打消息
                let callingMessage = now + " 播放临时音频：" + temporaryAudioLocalPath;
                callingMessageList.push(callingMessage);
            }
            
        },
        //通话中结束播放默认音频
        OnTalkStopAudio()
        {
            let { callWebSocket,devicename} = this;
            // this.isShowIntervention = false;
             //本地耳机到远端手机开关
            this.HeadSetToChannel(true);
            callWebSocket.send('{"command":"PlayStopRecord_Multi","arguments":{"devicename":"'+devicename+'"}}');
        },
        // 通话中 开始播放音频（测试）
        PlayStartRecordTest(){
            let {testTalkPlayAudio,devicename,callWebSocket} = this;
             //本地耳机到远端手机开关
            this.HeadSetToChannel(false);
            let command = {
                command:"PlayStartRecord_Multi",
                arguments:{
                    devicename,
                    content:testTalkPlayAudio
                }
            }
            console.log("播放音频_(测试)_command",JSON.stringify(command));
            callWebSocket.send(JSON.stringify(command));
        },
        //临时拨号
        onTemporaryDial(){
            let {temporaryNumber} = this;
            this.OnDial({mobile:temporaryNumber});
        },
        //拨号
        OnDial (extraparam) {
        const { callingMessageList,dateFormat } = this;
        let now = moment().format(dateFormat);
           let {devicename} = this;
           let mobile = extraparam.mobile;
            if (mobile) {    
                mobile = mobile.trim();    
                if (devicename == null) {
                    this.$message.warning('请插入设备');
                    return;
                }
                let commandData = {
                    command: "Dial_Multi",
                    arguments:{
                        phone:mobile,
                        devicename,
                        extraparam
                    }
                }
                this.callWebSocket.send(JSON.stringify(commandData));
                    // 添加拨打消息
                let callingMessage = now + " 拨打电话：" + mobile;
                callingMessageList.push(callingMessage);
            } else {
                this.$message.warning('电话号码不存在');
            }
        },
        //挂断
        OnHangup ()
        {
            this.callWebSocket.send('{"command":"HangUp_Multi","arguments":{"devicename":"' + this.devicename + '"}}');
            this.callOpen = false;
        },
        //接听
        OnAnswer ()
        {
            this.callWebSocket.send('{"command":"Answer_Multi","arguments":{"devicename":"' + this.devicename + '"}}');
        },
        //获取语音盒子 配置，并进行设置
        SetGetConfig( ){
             let { callWebSocket,userInfo } = this;
            // autorecordenable, //自动录音开关
            // autorecordfilenametype, //自动录音文件名类型 0:wav格式 1:mp3格式 2:wav格式(不带电话号码) 3: mp3格式(不带电话号码)
            // autouploadlogenable, //自动上传通话记录开关
            // autouploadlogurl, //自动上传通话记录url 格式post json
            // autouploadenable, //自动上传录音文件开关
            // autouploadtype, //自动上传录音文件方式 /0: post form /1:阿里云oss
            // autouploadurl //自动上传录音文件url
            let commandObj ={
                command:"SetConfig",
                arguments:{
                    pid: userInfo.companyId,    //设置pid
                    autouploadlogtype:1,
                    autorecordenable: true, //自动录音开关
                    autorecordfilenametype: 1, //自动录音文件名类型 0:wav格式 1:mp3格式 2:wav格式(不带电话号码) 3: mp3格式(不带电话号码)
                    autouploadlogenable: true, //自动上传通话记录开关
                    autouploadlogurl: this.$Global.ApiBaseUrl + "/crm/callTaskRecord/addCallBackInfo", //自动上传通话记录url 格式post json
                    autouploadenable: true, //自动上传录音文件开关
                    autouploadtype: 0, //自动上传录音文件方式 /0: post form /1:阿里云oss
                    autouploadurl: this.$Global.ApiBaseUrl + "/crm/callTaskRecord/uploadAudio" //自动上传录音文件url
                }
            }
            callWebSocket.send(JSON.stringify(commandObj));
        },
        //设置设备USB声卡音量
        SetDeviceWindowsAudio(){
            let { callWebSocket,devicename } = this;
            console.log("设置设备USB声卡音量",devicename);
            let command = {
                command:"SetDeviceWindowsAudio",
                arguments:{
                    content:'20'
                }
            }
            console.log("设置设备USB声卡音量",JSON.stringify(command));
            callWebSocket.send(JSON.stringify(command));
        },
        //设置音量
        SetAudio(){
            let { callWebSocket,localaudio,phoneaudio,devicename } = this;
            console.log("设置音量_必要参数",callWebSocket,localaudio,phoneaudio,"devicename--->",devicename);
            if(!devicename)return;
            let command = {
                command:"SetDeviceAudio_Multi",
                arguments:{
                    localaudio,
                    phoneaudio,
                    devicename
                }
            }
            console.log("设置音量_命令",JSON.stringify(command));
            callWebSocket.send(JSON.stringify(command));
        },
        //获取音量
        GetAudio(){
            let { callWebSocket,devicename } = this;
            let command = {
                command:"GetDeviceAudio_Multi",
                arguments:{
                    devicename
                }
            }
            callWebSocket(JSON.stringify(command));
        },
        //校验 是不是 已经超过 最大拨打次数
        checkSIMcurrentCallTimes(){
            let { SIMcurrentCallTimes, maxCallTimes,isAutoChangeSIM} = this;
            console.log("是否开启自动换卡",isAutoChangeSIM);
            if(!isAutoChangeSIM)return;
            console.log("校验 是否 切换卡槽。。。。，最大次数：",maxCallTimes,"当前拨打次数：",SIMcurrentCallTimes)
            if(SIMcurrentCallTimes >= maxCallTimes){
                console.log("自动换卡.....");
                this.SwitchNext();
                this.SIMcurrentCallTimes = 0;
            }
        },
        //顺序换卡
        SwitchNext(){
            let { callWebSocket,devicename } = this;
            let command = {
                command:"CBSwitchNext_Multi",
                arguments:{
                    devicename
                }
            }
            this.loading = true;
            try{
                console.log("顺序换卡",JSON.stringify(command));
                callWebSocket.send(JSON.stringify(command));
            }catch(e){
                this.loading = false;
            }
        },
        //获取命令
        GetCommandAction(command){
             let { callWebSocket,devicename } = this;
            let commandObj = {
                command:command,
                arguments:{
                    devicename
                }
            }
            callWebSocket.send(JSON.stringify(commandObj));
        },
        onMaxCallTimesChange(e){
            console.log("设置最大拨打次数",e.target.value,e);
            this.maxCallTimes = e.target.value;
        },
        onAfterLocalaudioChange(value){
            console.log("设置本地声音_滑动",value);
            this.localaudio = value;
            this.SetAudio();
           
        },
        onLocalaudioChange(e){
            console.log("设置本地声音_输入框",e.target.value,e);
            this.localaudio = e.target.value;
            this.SetAudio();
        },
         onAfterPhoneaudioChange(value){
            console.log("设置手机听到声音_滑动",value);
            this.phoneaudio = value;
            this.SetAudio();
           
        },
        onPhoneaudioChange(e){
            console.log("设置手机听到声音_输入框",e.target.value,e);
            this.phoneaudio = e.target.value;
            this.SetAudio();
        },

        /************************* 语音盒子 通信 解析 ******************************/
        //卡槽拔插上报
        OnCBCallback(msgJsonData){
            let {dynamicdata} = msgJsonData;
            let {
                index,             //位置索引 0开始
                state             //状态 0:拔出 1:插入
            } = dynamicdata;
            this.$set(this.SIMState,"s"+(index + 1),state == "1");
            console.log("卡槽拔插上报",this.SIMState);
        },
        //设备实时状态（状态变化时上报）
        OnRealTimeState(msgJsonData){
            let {dynamicdata} = msgJsonData;
            let {
                realtimestate, //状态类型 1. outgoing //设备呼出   2. ringback //对方振铃3. incoming //收到来电4. outconnected //呼出接通 5. inconnected //呼入接通6. hangup //挂断7. idle //空闲 
                number, //电话号码
                talkid, //当前通话id
                type,   //通话类型 "out":呼出 "in":呼入
                extraparam //自定义参数，拨号时传入
            } = dynamicdata;
            this.talkid = talkid;   
            this.phoneNumber = number;
            switch (realtimestate) {
                case 'outgoing': {
                         this.talkState = '呼出中...';
                         this.callOpen = true;
                    }
                    break;
                case 'ringback': {
                    this.talkState = '振铃中...';
                    this.SIMcurrentCallTimes++;
                    }
                    break;
                case 'incoming': this.talkState = '呼入中...';this.callOpen = true;break;
                case 'outconnected': this.OutconnectedCallBack(dynamicdata);break;
                {
                    
                    };break;
                case 'inconnected': this.talkState = '呼入接通'; break;
                case 'hangup': this.HangupCallBack(); break;
                case 'idle': this.talkState = '空闲'; break;
                default: break;
            }
        },
        //上传语音文件
        UploadFile(){
            let { callWebSocket,localaudio,phoneaudio,devicename } = this;
            let command = {
                command:"UploadFile",
                arguments:{
                    url: this.$Global.ApiBaseUrl + "/crm/callTaskRecord/uploadAudio",
                    file:"records\\production_out_19923478890_20220308182616_EV785B2021100174220220308182608295.mp3"
                }
            }
            callWebSocket.send(JSON.stringify(command));
        },
        //通话记录（通话结束后上报）处理 CallRecord 
        OnCallRecord(msgJsonData){
            // msgJsonData = {"devicename":"EV785B20211001742","dynamicdata":{"answertime":"","endtime":"2022-03-07 08:46:44","number":"19923478890","starttime":"2022-03-07 08:46:40","state":0,"talkid":"EV785B2021100174220220307084640588","type":0},"type":"CallRecord"};
            let {dynamicdata} = msgJsonData;
            let {
                type, //类型 0：呼出 1：呼入
                state,//应答状态 0：// 呼出 ，对方未振铃，可能是空号 1:// 呼出 ，对方未接听2：//接通3：// 呼入，未接来电
                starttime,//开始时间
                answertime,//接听时间
                endtime,//结束时间
                number,//号码
                talkid,//通话id
                extraparam,//自定义参数，拨号时传入
            } = dynamicdata;
          
        },
        //自动录音上报
        OnAutoRecord(msgJsonData){
            let {dynamicdata} = msgJsonData;
            let {
                type,               //录音类型 start:开始录音 stop:停止录音
                filename,           //文件名
                state,              //状态 true: 成功 false: 失败
            } = dynamicdata;
        },
        // 请求返回 CommandResponse
        OnCommandResponse(msgJsonData){
            let state = msgJsonData.data.state;
            let responseMessage = msgJsonData.message;
            let command = msgJsonData.data.invoke_command;
            let { dynamicdata } = msgJsonData;
            const { callingMessageList,dateFormat } = this;
                let now = moment().format(dateFormat);
                let result = "成功";
            switch(command){
                //获取设备列表
                case 'GetConnectedState_Multi':{
                    if(state){
                        let deviceList = dynamicdata.devicelist;
                        if (!deviceList) {
                            this.$store.dispatch("SetDeviceName",null);
                            // this.devicename = null;
                        } else {
                            let currDeviceName = deviceList.split(',')[0];
                            // this.devicename = currDeviceName;
                             this.$store.dispatch("SetDeviceName",currDeviceName);
                            if(!this.isSetAudio){
                                this.SetAudio(); //设置声音（本地听到音量，对方听到音量）
                            }
                            console.log('设备名称：',currDeviceName)
                        }
                    }
                   
                };break;
                //获取音量
                case "GetDeviceAudio_Multi":{
                    if(state){
                        // let { localaudio, phoneaudio } = dynamicdata;
                        // Object.assign(this,{localaudio, phoneaudio})
                        
                    }
                };break;
                //获取通话状态
                case "GetTalkState_Multi":{
                    if(state){
                        //请求返回
                        switch (dynamicdata.realtimestate) {
                            case 'outgoing':this.talkState = '呼出中...';break;
                            case 'ringback':this.talkState = '振铃中...';break;
                            case 'incoming':this.talkState = '呼入中...';break;
                            case 'outconnected':this.talkState = '呼出接通'; break;
                            case 'inconnected':this.talkState = '呼入接通';break;
                            case 'hangup':this.talkState = '挂断';break;
                            case 'idle':this.talkState = '空闲';break;
                            default:break;
                        }
                    }
                };break;
                //获取CCID
                case "GetCCID_Multi":{
                    if(state){
                        let { service } = dynamicdata;
                        switch(service){
                            case "CHINA MOBILE":this.SIMServer = "中国移动";break;
                            case "CHN-CT":this.SIMServer = "中国电信";break;
                            case "CHN-UNICOM":this.SIMServer = "中国联通";break;
                            default:this.SIMServer = "";break;
                        }
                    }
                };break;
                //获取当前SIM卡索引
                case "GetCBCurrSim_Multi":{
                    if(state){
                        this.SIMcurrent= dynamicdata.simid;
                    }
                };break;
                //插卡状态
                case "GetCBCurrState_Multi":{
                    if(state){
                        let stateList = dynamicdata.split(',');
                        let index = 1;
                        stateList && stateList.forEach(val=>{
                            this.SIMState["s"+index] = val === "1";
                            index++;
                        });
                    }
                };break;
                //获取信号
                case "GetSignalLevel_Multi":{
                    if(state){
                       this.SIMlevel = dynamicdata.level;
                    }
                };break;
                //保存配置
                case "SetConfig":{
                    if(state){
                        this.$message.success("自动录音设置成功");
                    }else{
                        this.$message.error("自动录音设置失败");
                    }
                };break;
                //保存音量设置
                case "SetDeviceAudio_Multi":{
                    if(state){
                        this.$message.success("音量设置成功");
                    }else{
                        this.$message.error("音量设置失败");
                    }
                };break;
                //获取推送失败通话记录数量
                case "GetUpdloadErrorLog":{
                    if(state){
                       
                    }else{
                       
                    }
                };break;
                //获取推送失败通话记录数量
                case "GetUploadErrorRecord":{
                    if(state){
                       
                    }else{
                        
                    }
                };break;
                //推送
                case "CBSwitchNext_Multi":{
                    this.loading = false;
                    if(state){
                        this.$message.success("换卡成功");
                        this.SIMlevel = null;
                        this.SIMServer = null;
                        this.GetCommandAction("GetCBCurrState_Multi");  //插卡状态
                        this.GetCommandAction("GetCBCurrSim_Multi");    //获取当前SIM卡索引
                        this.GetCommandAction("GetSignalLevel_Multi");//获取信号
                        this.GetCommandAction("GetCCID_Multi");//获取信号
                    }else{
                        this.$message.warning("换卡失败");
                    }
                };break;
                // 拨打
                case "Dial_Multi": {
                    if(!state){
                        this.$message.warning("拨打失败，请稍后重试");
                        result = "失败";
                    }
                    // 添加拨打消息
                    let callingMessage = now + " 拨打" + result;
                    callingMessageList.push(callingMessage);
                }; break;
                 // 播放音频
                case "PlayStartRecord_Multi": {
                    if(state){
                        //本地耳机到远端手机开关
                        this.HeadSetToChannel(false);
                        //设置 音频播放提示的参数，并监听播放完成
                        this.SetPlayAudioWarning();
                        this.isShowIntervention = true;
                    }else{
                        result = "失败";
                    }
                    // 添加拨打消息
                    let callingMessage = now + " 播放音频：" + result;
                    callingMessageList.push(callingMessage);
                }; break;
                // 停止播放音频
                case "PlayStopRecord_Multi": {
                    if(state){
                        this.isShowIntervention = false;
                    }else{
                        if(responseMessage == "not audio is playing"){
                            this.isShowIntervention = false;
                        }
                        result = "失败";
                    }
                    // 添加拨打消息
                    let callingMessage = now + " 停止播放音频：" + result;
                    callingMessageList.push(callingMessage);
                }; break;
                
                // 下载音频 到 语音盒子
                case "audiodownload": {
                    if(state){
                         if(this.downLoadType == 0){
                            console.log("任务音频和临时音频 同时 下载成功");
                            this.temporaryAudioLocalPath = dynamicdata.path;
                            this.talkPlayAudio = dynamicdata.path;
                            if(this.openBoxData.voiceUrl){
                                this.localAudioMap.set(this.openBoxData.voiceUrl,dynamicdata.path);
                            }
                        }else if(this.downLoadType == 1){
                            console.log("任务 音频下载成功");
                            this.talkPlayAudio = dynamicdata.path;
                            if(this.openBoxData.voiceUrl){
                                this.localAudioMap.set(this.openBoxData.voiceUrl,dynamicdata.path);
                            }
                        }else if(this.downLoadType == 2){
                             console.log("临时拨号 音频下载成功");
                             this.temporaryAudioLocalPath = dynamicdata.path;
                        }
                        this.$message.success("下载音频到语音盒子成功");
                    }else{
                        result = "失败";
                    }
                }; break;
                

            }

        },
        // 当前播放进度
        updateTime(e) {
            console.log("当前播放进度",e.target.currentTime);
            Object.assign(this.playAudioWarningData,{currentTime:parseInt(e.target.currentTime)});
        },
        // 获取音乐总长度
        getDuration() {
            console.log("获取音频总长度",this.$refs.playAudioWarningDome.duration);
            Object.assign(this.playAudioWarningData,{duration:parseInt(this.$refs.playAudioWarningDome.duration)});
        },
        //设置 音频播放提示的参数，并监听播放完成
        SetPlayAudioWarning(){
            const { openBoxData } = this;
            if(openBoxData){
                this.playAudioWarning = true;
                let data = {
                    src: openBoxData.voiceUrl,
                    volume: 0
                }
                this.$refs.myAudioOne.init(data);
            }
            
            // const { openBoxData } = this;
            // let _this = this;
            // let playAudioWarningDome = this.$refs.playAudioWarningDome;
            
            // if(playAudioWarningDome && openBoxData){
            //     // this.isShowIntervention = true;
            //     //本地耳机到远端手机开关
            //     // this.HeadSetToChannel(false);
            //     playAudioWarningDome.volume = 0;
            //     playAudioWarningDome.src = openBoxData.voiceUrl;
            //     playAudioWarningDome.play();// 播放
            //     //监听播放完成自动介入
            //     playAudioWarningDome.addEventListener('ended', function () {  
            //         if(_this.isShowIntervention){
            //             console.log("电脑音频播放完毕，自动介入");
            //             _this.OnTalkStopAudio();
            //         }
            //     }, false);
            // }
        },
        StopPlayAudioWarning(){
            let playAudioWarningDome = this.$refs.playAudioWarningDome;
            if(playAudioWarningDome){
                playAudioWarningDome.pause();
            }
        },
        /********************* 语音盒子 业务逻辑处理 ***************************/
        //外呼接听 回调处理
        OutconnectedCallBack(dynamicdata){
             let { openBoxData } = this;
             let {
                realtimestate, //状态类型 1. outgoing //设备呼出   2. ringback //对方振铃3. incoming //收到来电4. outconnected //呼出接通 5. inconnected //呼入接通6. hangup //挂断7. idle //空闲 
                number, //电话号码
                talkid, //当前通话id
                type,   //通话类型 "out":呼出 "in":呼入
                extraparam //自定义参数，拨号时传入
            } = dynamicdata;
            this.talkState = '呼出接通';
            this.OnTalkPlayAudio(extraparam);             //播放音频
            //回调 
            if(openBoxData && openBoxData.OutconnectedCallBack){
               openBoxData.OutconnectedCallBack(extraparam,"touch");
            }
            // this.goToDetail(extraparam,"touch");//打开 客户详情 抽屉
           
        },
        //挂断  回调处理
        HangupCallBack(){
            let { openBoxData } = this;
            this.resetCallBox();
            this.talkState = '挂断';
            //回调 
            if(openBoxData && openBoxData.HangupCallBack){
                setTimeout(()=>openBoxData.HangupCallBack(),2000); //刷新 页面数据
            }
            this.checkSIMcurrentCallTimes();    //校验 拨打次数
            this.OnTalkStopAudio();
        },
        
        
    },
    watch:{
         settings (data) {
            let { devicename } = this;
            console.log("语音盒子Box:watch->settings",data);
            Object.assign(this,data);
            if(devicename){
                this.isSetAudio = true;
                this.SetAudio();            //设置声音（本地听到音量，对方听到音量）
            }
        },
    }

    //CBSwitchNext_Multi   顺序换卡: 切换到下张可用SIM卡，自动略过空卡槽。webSocket.send('{"command":"CBSwitchNext_Multi","arguments":{"devicename":"EV78520200600112"}}');
    //
  

};
</script>


<style lang="less">
.nomber-style-title {
	text-align: left;
	font-size: 20px;
	width: 95%;
	margin: auto;
	margin-top: 10px;
}
.phone-bottom-list {
	width: 60%;
	margin: auto;
	display: flex;
	justify-content: space-around;
}
.phone-type {
	height: 80px;
	width: 80px;
	line-height: 80px;
	margin: auto;
	margin-top: 25px;
	border-radius: 80px;
	background-color: #fff;
	color: #41CC9D;
	cursor: pointer;
    font-size: 20px;
}


.tow-bottom {
	position: relative;
	top: 200px;
}

.nimber-inpt {
	background-color:  #2A3B42;
	border: 0;
	outline:none; 
	color: #FFFFFF;
}
.ttc{
    margin: -10px 0px -10px -20px;
}
.phone-frame {
	border: 1px solid #2A3B42;
	width: 300px;
	height: 485px;
	background-color: #2A3B42;
	color:  #fff;
	text-align: center;
	font-size: 10px;
    // margin: -24px;
    padding-bottom: 30px;
    
} 

.information-frame {
	width: 100%;
	// margin: auto;
	height: 50px;
	// margin-bottom: 24px;
	display: flex;
	justify-content: space-between;
	padding: 5px;
    font-size: 14px;
	/* background-color: #FFFFFF; */
}
	
.information-first {
	width: 4rem;
    font-size: 12px;
	// padding: 0 20px 0 10px;
}

.phone {
    font-size: 24px;
	// height: 15px;
}

.phone-name {
	color: #41CC9D;
}
.phone-lose{
    font-size: 36px;
}

.bt-color{
	color: #1890ff;;
}


.phone-txt-color {
	/* color: #000; */
	// font-size: 10px;
	white-space:nowrap;
	overflow: hidden;
}

.list-color {
	color: #7EC1FF;
}

.information-second {
	width: 120px;
	// padding: 0 0 0 10px;
}

.second-txt {
	// width: 100px;
	text-align: left !important;
}

.information-third {
	display: flex;
	padding-right: 10px;
	overflow: hidden;
}
.third-box {
	padding: 0 10px 0 0;
    cursor: pointer;
    font-size: 12px;
}

.nomber-style {
	width: 80%;
	margin:auto;
	text-align: left;
	font-size: 14px;
	margin-top: 20px;
	border-bottom: 1px solid #536065;
	white-space:nowrap;
	overflow: hidden;
	padding: 0 0 5px 0;
    font-size: 24px;
}

.keyboard {
	width: 80%;
	margin: auto;
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	margin-top: 10px;
	border-bottom: 1px solid #536065;
	padding: 0 0 5px 0;
    font-size: 24px;
}

.keyboard-number {
	width: 60px;
    height: 50px;
    line-height: 50px;
	text-align: center;
    cursor: pointer;
	/* padding: 0 0 0 10px; */
}

.input-list {
	width: 80%;
	margin: auto;
	text-align: left !important; 
	margin-top: 15px;
}
.inp-style {
	width: 120px;
    
}

.input-list-nin{
	margin-left: 5px;
	display: flex;
	justify-content: space-between;
}

.button-style{
	padding: 0 0 0 5px;
    color: #fff;
}
.nimber-inpt {
	background-color:  #2A3B42;
	border: 0;
	outline:none; 
	color: #FFFFFF;
    width: 100%;
    font-size: 24px;
}
</style>

<style lang="less" scoped>
.messageBox{
    height: 250px;
    width: 100%;
    overflow: auto;
    text-align: left;
    padding: 0 30px;
}
// .messageBox::-webkit-scrollbar{
//         display: none;
// }
/deep/.ant-modal-header{
    padding: 10px 24px !important;
    background: #c0c0c0 !important;
    border-bottom: 0px solid #a0a0a0 !important;
}
/deep/.ant-modal-close-x {
  height: 21px !important;
  line-height: 18px !important;
  width: 30px !important;
}
// /deep/.ant-modal-mask{
//     display: none !important;
// }
/deep/.ant-modal-body{
    padding: 0px !important;
}
/deep/.ant-select-sm .ant-select-selection__rendered{
    line-height: 22px !important;
}
.ant-radio-group, .ant-checkbox-wrapper{
    font-size: 10px !important;
}
/deep/.ant-modal-footer{
    display: none !important;
}
</style>